<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-comment">-- ----------------------------------------------------------------------------</span><span>
</span><span id="line-2"></span><span class="hs-comment">-- | This module supplies bindings to generate Llvm IR from Haskell</span><span>
</span><span id="line-3"></span><span class="hs-comment">-- (&lt;http://www.llvm.org/docs/LangRef.html&gt;).</span><span>
</span><span id="line-4"></span><span class="hs-comment">--</span><span>
</span><span id="line-5"></span><span class="hs-comment">-- Note: this module is developed in a demand driven way. It is no complete</span><span>
</span><span id="line-6"></span><span class="hs-comment">-- LLVM binding library in Haskell, but enough to generate code for GHC.</span><span>
</span><span id="line-7"></span><span class="hs-comment">--</span><span>
</span><span id="line-8"></span><span class="hs-comment">-- This code is derived from code taken from the Essential Haskell Compiler</span><span>
</span><span id="line-9"></span><span class="hs-comment">-- (EHC) project.</span><span>
</span><span id="line-10"></span><span class="hs-comment">--</span><span>
</span><span id="line-11"></span><span>
</span><span id="line-12"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.Llvm</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-13"></span><span>        </span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmOpts"><span class="hs-identifier">LlvmOpts</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-14"></span><span>        </span><span class="annot"><a href="GHC.Llvm.Types.html#initLlvmOpts"><span class="hs-identifier">initLlvmOpts</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-15"></span><span>
</span><span id="line-16"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Modules, Functions and Blocks</span></span><span>
</span><span id="line-17"></span><span>        </span><span class="annot"><a href="GHC.Llvm.Syntax.html#LlvmModule"><span class="hs-identifier">LlvmModule</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-18"></span><span>
</span><span id="line-19"></span><span>        </span><span class="annot"><a href="GHC.Llvm.Syntax.html#LlvmFunction"><span class="hs-identifier">LlvmFunction</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmFunctionDecl"><span class="hs-identifier">LlvmFunctionDecl</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-20"></span><span>        </span><span class="annot"><a href="GHC.Llvm.Syntax.html#LlvmFunctions"><span class="hs-identifier">LlvmFunctions</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmFunctionDecls"><span class="hs-identifier">LlvmFunctionDecls</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-21"></span><span>        </span><span class="annot"><a href="GHC.Llvm.Syntax.html#LlvmStatement"><span class="hs-identifier">LlvmStatement</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Syntax.html#LlvmExpression"><span class="hs-identifier">LlvmExpression</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-22"></span><span>        </span><span class="annot"><a href="GHC.Llvm.Syntax.html#LlvmBlocks"><span class="hs-identifier">LlvmBlocks</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Syntax.html#LlvmBlock"><span class="hs-identifier">LlvmBlock</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Syntax.html#LlvmBlockId"><span class="hs-identifier">LlvmBlockId</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-23"></span><span>        </span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmParamAttr"><span class="hs-identifier">LlvmParamAttr</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmParameter"><span class="hs-identifier">LlvmParameter</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-24"></span><span>
</span><span id="line-25"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Atomic operations</span></span><span>
</span><span id="line-26"></span><span>        </span><span class="annot"><a href="GHC.Llvm.Syntax.html#LlvmAtomicOp"><span class="hs-identifier">LlvmAtomicOp</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-27"></span><span>
</span><span id="line-28"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Fence synchronization</span></span><span>
</span><span id="line-29"></span><span>        </span><span class="annot"><a href="GHC.Llvm.Syntax.html#LlvmSyncOrdering"><span class="hs-identifier">LlvmSyncOrdering</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-30"></span><span>
</span><span id="line-31"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Call Handling</span></span><span>
</span><span id="line-32"></span><span>        </span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmCallConvention"><span class="hs-identifier">LlvmCallConvention</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmCallType"><span class="hs-identifier">LlvmCallType</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmParameterListType"><span class="hs-identifier">LlvmParameterListType</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-33"></span><span>        </span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmLinkageType"><span class="hs-identifier">LlvmLinkageType</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmFuncAttr"><span class="hs-identifier">LlvmFuncAttr</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-34"></span><span>
</span><span id="line-35"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Operations and Comparisons</span></span><span>
</span><span id="line-36"></span><span>        </span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmCmpOp"><span class="hs-identifier">LlvmCmpOp</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmMachOp"><span class="hs-identifier">LlvmMachOp</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmCastOp"><span class="hs-identifier">LlvmCastOp</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-37"></span><span>
</span><span id="line-38"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Variables and Type System</span></span><span>
</span><span id="line-39"></span><span>        </span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmVar"><span class="hs-identifier">LlvmVar</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmStatic"><span class="hs-identifier">LlvmStatic</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmLit"><span class="hs-identifier">LlvmLit</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmType"><span class="hs-identifier">LlvmType</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-40"></span><span>        </span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmAlias"><span class="hs-identifier">LlvmAlias</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LMGlobal"><span class="hs-identifier">LMGlobal</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LMString"><span class="hs-identifier">LMString</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LMSection"><span class="hs-identifier">LMSection</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LMAlign"><span class="hs-identifier">LMAlign</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-41"></span><span>        </span><span class="annot"><a href="GHC.Llvm.Types.html#LMConst"><span class="hs-identifier">LMConst</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-42"></span><span>
</span><span id="line-43"></span><span>        </span><span class="annot"><span class="hs-comment">-- ** Some basic types</span></span><span>
</span><span id="line-44"></span><span>        </span><span class="annot"><a href="GHC.Llvm.Types.html#i64"><span class="hs-identifier">i64</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#i32"><span class="hs-identifier">i32</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#i16"><span class="hs-identifier">i16</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#i8"><span class="hs-identifier">i8</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#i1"><span class="hs-identifier">i1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#i8Ptr"><span class="hs-identifier">i8Ptr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#llvmWord"><span class="hs-identifier">llvmWord</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#llvmWordPtr"><span class="hs-identifier">llvmWordPtr</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-45"></span><span>
</span><span id="line-46"></span><span>        </span><span class="annot"><span class="hs-comment">-- ** Metadata types</span></span><span>
</span><span id="line-47"></span><span>        </span><span class="annot"><a href="GHC.Llvm.MetaData.html#MetaExpr"><span class="hs-identifier">MetaExpr</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.MetaData.html#MetaAnnot"><span class="hs-identifier">MetaAnnot</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.MetaData.html#MetaDecl"><span class="hs-identifier">MetaDecl</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.MetaData.html#MetaId"><span class="hs-identifier">MetaId</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-48"></span><span>
</span><span id="line-49"></span><span>        </span><span class="annot"><span class="hs-comment">-- ** Operations on the type system.</span></span><span>
</span><span id="line-50"></span><span>        </span><span class="annot"><a href="GHC.Llvm.Types.html#isGlobal"><span class="hs-identifier">isGlobal</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#getLitType"><span class="hs-identifier">getLitType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#getVarType"><span class="hs-identifier">getVarType</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-51"></span><span>        </span><span class="annot"><a href="GHC.Llvm.Types.html#getLink"><span class="hs-identifier">getLink</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#getStatType"><span class="hs-identifier">getStatType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#pVarLift"><span class="hs-identifier">pVarLift</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#pVarLower"><span class="hs-identifier">pVarLower</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-52"></span><span>        </span><span class="annot"><a href="GHC.Llvm.Types.html#pLift"><span class="hs-identifier">pLift</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#pLower"><span class="hs-identifier">pLower</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#isInt"><span class="hs-identifier">isInt</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#isFloat"><span class="hs-identifier">isFloat</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#isPointer"><span class="hs-identifier">isPointer</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#isVector"><span class="hs-identifier">isVector</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#llvmWidthInBits"><span class="hs-identifier">llvmWidthInBits</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-53"></span><span>
</span><span id="line-54"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Pretty Printing</span></span><span>
</span><span id="line-55"></span><span>        </span><span class="annot"><a href="GHC.Llvm.Ppr.html#ppVar"><span class="hs-identifier">ppVar</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Ppr.html#ppLit"><span class="hs-identifier">ppLit</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Ppr.html#ppTypeLit"><span class="hs-identifier">ppTypeLit</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Ppr.html#ppName"><span class="hs-identifier">ppName</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Ppr.html#ppPlainName"><span class="hs-identifier">ppPlainName</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-56"></span><span>        </span><span class="annot"><a href="GHC.Llvm.Ppr.html#ppLlvmModule"><span class="hs-identifier">ppLlvmModule</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Ppr.html#ppLlvmComments"><span class="hs-identifier">ppLlvmComments</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Ppr.html#ppLlvmComment"><span class="hs-identifier">ppLlvmComment</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Ppr.html#ppLlvmGlobals"><span class="hs-identifier">ppLlvmGlobals</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-57"></span><span>        </span><span class="annot"><a href="GHC.Llvm.Ppr.html#ppLlvmGlobal"><span class="hs-identifier">ppLlvmGlobal</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Ppr.html#ppLlvmFunctionDecls"><span class="hs-identifier">ppLlvmFunctionDecls</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Ppr.html#ppLlvmFunctionDecl"><span class="hs-identifier">ppLlvmFunctionDecl</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Ppr.html#ppLlvmFunctions"><span class="hs-identifier">ppLlvmFunctions</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-58"></span><span>        </span><span class="annot"><a href="GHC.Llvm.Ppr.html#ppLlvmFunction"><span class="hs-identifier">ppLlvmFunction</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Ppr.html#ppLlvmAlias"><span class="hs-identifier">ppLlvmAlias</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Ppr.html#ppLlvmAliases"><span class="hs-identifier">ppLlvmAliases</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Ppr.html#ppLlvmMetas"><span class="hs-identifier">ppLlvmMetas</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Ppr.html#ppLlvmMeta"><span class="hs-identifier">ppLlvmMeta</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-59"></span><span>
</span><span id="line-60"></span><span>    </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-61"></span><span>
</span><span id="line-62"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Llvm.Syntax.html"><span class="hs-identifier">GHC.Llvm.Syntax</span></a></span><span>
</span><span id="line-63"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Llvm.MetaData.html"><span class="hs-identifier">GHC.Llvm.MetaData</span></a></span><span>
</span><span id="line-64"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Llvm.Ppr.html"><span class="hs-identifier">GHC.Llvm.Ppr</span></a></span><span>
</span><span id="line-65"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html"><span class="hs-identifier">GHC.Llvm.Types</span></a></span><span>
</span><span id="line-66"></span><span>
</span><span id="line-67"></span></pre></body></html>